<template>
    <div>
        <span>组件B接收到A传递的数据：{{num}}</span>
    </div>
</template>
<script>
export default {
    data(){
        return{
            num:0
        }
    },
    mounted(){
        this.$bus.$on('helloFn',(payload) => {
            this.num = payload
        })
    },
    beforeDestroy(){
       
        this.$bus.$off('helloFn') 
    }
}
</script>